#!/bin/bash

# 获取脚本所在目录
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# 加载所有模块
source "$SCRIPT_DIR/common.sh"
source "$SCRIPT_DIR/docker.sh"
source "$SCRIPT_DIR/build.sh"
source "$SCRIPT_DIR/health.sh"
source "$SCRIPT_DIR/deploy.sh"

# 部署服务的主函数
deploy_service() {
    local service_name="$1"
    local container_port="$2"
    local host_port="$3"
    local replicas="$4"
    local profile="$5"
    local health_enabled="$6"
    local health_endpoint="$7"
    local cpu_limit="$8"
    local cpu_request="$9"
    local mem_limit="${10}"
    local mem_request="${11}"
    local target_path="${12}"
    shift 12
    local mounts=("$@")

    do_deploy \
        "$service_name" \
        "$container_port" \
        "$host_port" \
        "$replicas" \
        "$profile" \
        "$health_enabled" \
        "$health_endpoint" \
        "$cpu_limit" \
        "$cpu_request" \
        "$mem_limit" \
        "$mem_request" \
        "$target_path" \
        "${mounts[@]}"
}
